package com.ruoyi.web.controller.control;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.control.domain.InclinedshaftHistory;
import com.ruoyi.control.service.IInclinedshaftHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 斜井提升历史Controller
 *
 * @author ruoyi
 * @date 2024-12-20
 */
@RestController
@RequestMapping("/inclinedshaftHistory/inclinedshaftHistory")
public class InclinedshaftHistoryController extends BaseController
{
    @Autowired
    private IInclinedshaftHistoryService inclinedshaftHistoryService;

    /**
     * 查询斜井提升历史列表
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaftHistory:inclinedshaftHistory:list')")
    @GetMapping("/list")
    public TableDataInfo list(InclinedshaftHistory inclinedshaftHistory)
    {
        startPage();
        List<InclinedshaftHistory> list = inclinedshaftHistoryService.selectInclinedshaftHistoryList(inclinedshaftHistory);
        return getDataTable(list);
    }

    /**
     * 导出斜井提升历史列表
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaftHistory:inclinedshaftHistory:export')")
    @Log(title = "斜井提升历史", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, InclinedshaftHistory inclinedshaftHistory)
    {
        List<InclinedshaftHistory> list = inclinedshaftHistoryService.selectInclinedshaftHistoryList(inclinedshaftHistory);
        ExcelUtil<InclinedshaftHistory> util = new ExcelUtil<InclinedshaftHistory>(InclinedshaftHistory.class);
        util.exportExcel(response, list, "斜井提升历史数据");
    }

    /**
     * 获取斜井提升历史详细信息
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaftHistory:inclinedshaftHistory:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(inclinedshaftHistoryService.selectInclinedshaftHistoryById(id));
    }

    /**
     * 新增斜井提升历史
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaftHistory:inclinedshaftHistory:add')")
    @Log(title = "斜井提升历史", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody InclinedshaftHistory inclinedshaftHistory)
    {
        return toAjax(inclinedshaftHistoryService.insertInclinedshaftHistory(inclinedshaftHistory));
    }

    /**
     * 修改斜井提升历史
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaftHistory:inclinedshaftHistory:edit')")
    @Log(title = "斜井提升历史", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody InclinedshaftHistory inclinedshaftHistory)
    {
        return toAjax(inclinedshaftHistoryService.updateInclinedshaftHistory(inclinedshaftHistory));
    }

    /**
     * 删除斜井提升历史
     */
    @PreAuthorize("@ss.hasPermi('inclinedshaftHistory:inclinedshaftHistory:remove')")
    @Log(title = "斜井提升历史", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(inclinedshaftHistoryService.deleteInclinedshaftHistoryByIds(ids));
    }
}
